The present invention relates generally to computer programs, and more particularly to a method and apparatus for correcting common errors in multiple versions of a computer program using pattern substitution.
It is commonly known that software programs are constantly updated, adding new features and repairing errors. Each update is considered a new version and oftentimes, there are many versions of a software program in existence at any given time. As a result, many versions of a program may have commonly-shared problems, such as a common Year 2000 (Y2K) problem.
To repair a Y2K problem in multiple versions of a computer program by conventional methods would include modifying the source code and creating yet another new version. If there are N existing versions of a given program, such a repair could require the creation of N new versions. Furthermore, when creating a new version of the program using compilation tools, the variables may be at different memory locations than in the prior version, which could result in additional problems. For example, because complex software may contain small errors that are sensitive to the locations of these variables, this technique may result in an unexpected change in the behavior of the program. Therefore, additional testing is required to determine that no undesired behavioral changes were induced. In other words, the programmer who is repairing the program for one problem, for example a Y2K problem, must thoroughly test each version of the program to ensure that no additional problems have been caused because of the repair.
In order to avoid this problem, one method of correcting a problem in a program includes modifying specific locations in the software. This prior art method is known as a xe2x80x9csoftware patchxe2x80x9d and the benefits of reduced testing are widely understood. However, one disadvantage of a software patch is that it requires intervention at a machine code level, and thus is not in an easily readable form. Another disadvantage of this method is that repeating this for each and every version of the software that has been created is time consuming and labor intensive.
It would therefore be desirable to have a method and apparatus that is capable of repairing many versions of a software program to address a common problem, such as the Y2K problem, with little intervention and minimal programmer time.
The present invention relates to a method and apparatus for correcting a common problem in multiple versions of a computer programming using a pattern substitution method that solves the aforementioned problems.
The present invention was developed to address a Y2K problem in multiple versions of a software program within a limited time period. However, the invention is not limited to Year 2000 repairs, but is applicable to any common problem experienced in multiple versions of a software program. The benefits of this technique are exemplified, however, when given a fixed deadline, such as what the Year 2000 problem imposes. The invention expands upon the prior art software patch technique by allowing a means of repairing multiple versions of software with a single repair program. The benefits of reduced testing are then multiplied by the number of versions of the program that are in existence, while the disadvantage of machine code intervention is incurred but a single time and reduces the potential of altering the behavior of any particular version of the program.
Therefore, in accordance with one aspect of the invention, a method of correcting a common error in multiple versions of a computer program includes identifying the common error in the computer program and finding a common code section that contains the common error. The method next includes locating a segment of the common code section that is modifiable, modifying the segment located to correct the common error, and then writing a repair program to search the other versions of the computer program and perform the modification step automatically for each version of the computer program.
In accordance with another aspect of the invention, a computer repair program stored on a computer readable storage medium and designed to repair an error in a main computer program stored in a computer is disclosed. The computer program is designed to search the main computer program for an affected segment of the code defined by a predetermined word string that is based on a previous review of an exemplary version of the main computer program. Once the repair program locates the affected segment, the repair program replaces the affected segment of code with a repaired segment.
Various other features, objects and advantages of the present invention will be made apparent from the following detailed description and the drawings.